$(function () {
  $('#login_form').submit(function (e) {

    e.preventDefault();

    let parms = $('#login_form').serialize();
    $.ajax({
      url: 'http://localhost:8080/api/v1/admin/user/login',
      type: "post",
      data: parms,
      beforeSend: function () {
        //弹出加载层
        index = layer.load();
      },

      complete: function () {
        layer.close(index)
      },
      success: function (resData) {
        if (resData.code != 200) {
          alert(resData.msg);
          return;
        }

        // 将token保存到本地存储中
        localStorage.setItem('bignews_token', resData.token);

        //跳到首页
        window.location = './index.html';
      }


    })

  })




})